class Solution {
public:
    int minimumOperationsToMakeKPeriodic(string word, int k) {
        int x = word.size() / k;
        map<string, int> mp;
        for (int i = 0; i < word.size(); i += k) {
            mp[word.substr(i, k)]++;
        }
        int mx = 0;
        for (auto i : mp) mx = max(mx, i.second);
        return x - mx;
    }
};